/*
 * @Author: 千锋爱佛僧
 * @公众号: 大前端私房菜
 * @Slogan: 千锋精品教程，好学得不像实力派！
 */
// 数字操作逻辑
import { defineStore } from "pinia";

export const useCounter = defineStore("count", {
  state: () => {
    return {
      num: 100,
    };
  },
  actions: {
    increment() {
      this.num++;
    },
    decrement(n: number) {
      this.num -= n;
    },
  },
  // persist: true, //开启持久化存储
  persist: {
    storage: sessionStorage,
    key: "count-2301",
  },
});
